<!-- //路由部分
//  //模拟设置ajax传值
//  Route::post('ajaxxx',function(){
//      echo 'ajax返回成功';
//  });
//  Route::get('/getAjax',function(){
//      return view('getAjax');
//  });
 -->
<!DOCTYPE html>
<html>
    <head>
        <title>获取AJAX操作</title>
        
        <!-- <meta name="csrf-token" content="{{csrf_token()}}"> -->
        <meta name="csrf-token" content="{{csrf_token()}}">
        <script type="text/javascript" src='./jquery-1.7.2.js'></script>
        <style>
            html, body {
                height: 100%;
            }

            body {
                margin: 0;
                padding: 0;
                width: 100%;
                display: table;
                font-weight: 100;
                font-family: 'Lato';
            }

            .container {
                text-align: center;
                display: table-cell;
                vertical-align: middle;
            }

            .content {
                text-align: center;
                display: inline-block;
            }

            .title {
                font-size: 96px;
            }
        </style>
    </head>
    <body>
        <!-- <div class="container">
            <div class="content">
                <div class="title">Laravel 5 欢迎~gohome！</div>
            </div>
        </div> -->
        <button type="button">点击发送ajax</button>
        <script type="text/javascript">
            // alert($);
            $(function(){
                $('button').click(function(){
                    // alert($);
                    $.ajaxSetup({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        },

                    });
                    //alert(111);
                    $.ajax({
                        url: '/ajaxxx',
                        type: 'post',
                        dataType: 'text',
                        //data: {name: 'kaka',age:18},
                        success:function(data){
                            alert(data); 
                        },
                    })
                })            
            });          
        </script>
    </body>
</html>
